package com.fuqi.android.zhongcai.utils;

import android.graphics.Color;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import android.widget.TextView;


/**
 * Created by juner on 2015/12/29.
 */
public class TextColorUtils {


    public static void changeTextColor(TextView tv) {
        SpannableStringBuilder builder = new SpannableStringBuilder(tv.getText().toString());
        ForegroundColorSpan redSpan = new ForegroundColorSpan(Color.rgb(254, 177, 1));
        builder.setSpan(redSpan, 4, tv.getText().toString().trim().length() - 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        tv.setText(builder);

    }


    public static void changeVersionTextColor(TextView tv) {
        SpannableStringBuilder builder = new SpannableStringBuilder(tv.getText().toString());
        ForegroundColorSpan redSpan = new ForegroundColorSpan(Color.rgb(254, 177, 1));
        builder.setSpan(redSpan, 5, tv.getText().toString().trim().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        tv.setText(builder);

    }


    public static void changeContactTextColor(TextView tv) {
        SpannableStringBuilder builder = new SpannableStringBuilder(tv.getText().toString());
        ForegroundColorSpan redSpan = new ForegroundColorSpan(Color.rgb(254, 177, 1));
        builder.setSpan(redSpan, 6, tv.getText().toString().trim().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        tv.setText(builder);

    }


}
